# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import datetime

from django.db import models

# Create your models here.


class CityDict(models.Model):
	name = models.CharField(verbose_name=u'城市名称', max_length=20)
	desc = models.CharField(verbose_name=u'城市描述', max_length=200)
	create_time = models.DateTimeField(verbose_name=u'创建时间', default=datetime.datetime.now)

	class Meta:
		verbose_name = u'城市'
		verbose_name_plural = verbose_name

	def __unicode__(self):
		return self.name


class CourseOrg(models.Model):
	name = models.CharField(verbose_name=u'机构名称', max_length=50)
	desc = models.TextField(verbose_name=u'机构描述')
	click_nums = models.IntegerField(verbose_name=u'点击数', default=0)
	fav_nums = models.IntegerField(verbose_name=u'收藏数', default=0)
	image = models.ImageField(verbose_name=u'机构封面', upload_to='static/media/organization/image_CourseOrg/%Y/%m', max_length=100)
	address = models.CharField(verbose_name=u'机构地址', max_length=150)
	city = models.ForeignKey('CityDict', verbose_name=u'所属城市')
	create_time = models.DateTimeField(verbose_name=u'创建时间', default=datetime.datetime.now)

	class Meta:
		verbose_name = u'课程机构'
		verbose_name_plural = verbose_name

	def __unicode__(self):
		return self.name


class Teacher(models.Model):
	org = models.ForeignKey('CourseOrg', verbose_name=u'所属机构')
	name = models.CharField(verbose_name=u'讲师名称', max_length=50)
	work_years = models.ImageField(verbose_name=u'工作年限', default=0)
	work_company = models.CharField(verbose_name=u'就职公司', max_length=50)
	work_position = models.CharField(verbose_name=u'公司职位', max_length=50)
	points = models.CharField(verbose_name=u'教学特点', max_length=50)
	click_nums = models.IntegerField(verbose_name=u'点击数', default=0)
	fav_nums = models.IntegerField(verbose_name=u'收藏数', default=0)
	create_time = models.DateTimeField(verbose_name=u'创建时间', default=datetime.datetime.now)

	class Meta:
		verbose_name = u'讲师'
		verbose_name_plural = verbose_name

	def __unicode__(self):
		return self.name
